package cc.rengu.oltp.service.common.enums;

import cc.rengu.oltp.utility.util.StringUtil;

/**
 * 业务状态枚举
 * Created by 王成 on 2020/2/21.
 */
public enum BizStatusEnum {
    INIT("--", "业务初始状态"),
    FINISH("00", "业务处理成功"),
    PROCESSING("01", "业务处理中"),
    FAILED("02", "业务处理失败"),
    PAYING("03", "付款中"),
    CANCEL("10", "已撤销"),
    PART_CANCEL("11", "已部分撤销"),
    REVSAL("20", "已冲正"),
    PART_REVSAL("21", "已部分冲正"),
    REFUND("30", "已全额退款"),
    PART_REFUND("31", "已部分退款"),
    NOT_CONFIRM_REFUND("32", "未确认收货全额退款"),
    NOT_CONFIRM_PART_REFUND("33", "未确认收货部分退款"),
    AUTH_INCOMPLETE("40", "授权未完成"),
    AUTH_COMPLETE("41", "授权已完成"),
    CONFIRM("50", "已确认收货"),
    COUPON_REDEEM("51", "卡券已核销"),
    SETTLE("99", "已清算"),
    ;

    private String status;
    private String desc;

    BizStatusEnum(String status, String desc) {
        this.status = status;
        this.desc = desc;
    }

    public static String getDescByStaus(String status) {
        if (StringUtil.isEmptyOrNull(status)) {
            return null;
        }

        for (BizStatusEnum bizStatusEnum : BizStatusEnum.values()) {
            if (bizStatusEnum.getStatus().equals(status)) {
                return bizStatusEnum.getDesc();
            }
        }

        return null;
    }


    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }
}
